| Class | SimplyPresentable::ArrayPrototypePresenter |
| In: |
vendor/plugins/simply_presentable/lib/simply_presentable/presenter/array_prototype.rb
|
| Parent: | SimplyPresentable::Presenter |
Will replace the element on the page corresponding to the presented array by rendering the partial as in ArrayPrototypePresenter#render_as
render_update { |page| present(Foo.find(:all)).replace_as_on('foos', page) }
This renders the partial foos/index and replaces the element with id foos on the page with the partial
Options:
| :dom_prefix: | Prefix the dom_id |
The options for PartialPresenter#partial_options can be used to control the rendering of the partial
# File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/array_prototype.rb, line 13
13: def replace_as_on(partial_dir, page, options = {})
14: local_options = options.dup
15: page.replace(
16: dom_id(partial_dir, options),
17: @presenter_proxy.partial_options(options.reverse_deep_merge(:variable_name => partial_dir, :partial_dir => partial_dir))
18: )
19: end
like replace_html_as_on except replaces the inner html rather than the outer html.
# File vendor/plugins/simply_presentable/lib/simply_presentable/presenter/array_prototype.rb, line 22
22: def replace_html_as_on(partial_dir, page, options = {})
23: local_options = options.dup
24: page.replace_html(
25: dom_id(partial_dir, options),
26: @presenter_proxy.partial_options(options.reverse_deep_merge(:variable_name => partial_dir, :partial_dir => partial_dir))
27: )
28: end